using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using Common;
using SSettings;

namespace MainView.Windows
{
    public partial class ChannelNotMatchWindow : Window, IComponentConnector
    {
        public ChannelNotMatchWindow(byte[] deviceChannel, string projectChannel)
        {
            InitializeComponent();


            ChannelSetting channelSetting = ConfigSettings.GetInstance().ChannelSetting;
            List<string> list = new List<string>();
            List<string> list2 = new List<string>();
            for (int i = 0; i < 6; i++)
            {
                list.Add(channelSetting.AllChannelProperty[deviceChannel[i]].WaveLength);
                string[] array = projectChannel.Split('&');
                int result = 0;
                int.TryParse(array[i], out result);
                list2.Add(channelSetting.AllChannelProperty[result].WaveLength);
            }
            grid.ItemsSource = new List<List<string>> { list, list2 };
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void grid_LoadingRow(object sender, DataGridRowEventArgs e)
        {
            switch (e.Row.GetIndex())
            {
                case 0:
                    e.Row.Header = Utility.GetMessage("device");
                    break;
                case 1:
                    e.Row.Header = Utility.GetMessage("Project");
                    break;
            }
        }
    }
}
